[PATCH] fix null pointer dereference in xen_guest_lookup()
authorAlex Williamson <alex.williamson@hp.com>
Sun, 27 Aug 2006 05:56:01 +0000 (06:56 +0100)
committerAlex Williamson <alex.williamson@hp.com>
Sun, 27 Aug 2006 05:56:01 +0000 (06:56 +0100)
  The latest ELF changes have a null pointer dereference bug when you
have neither an elf notes section nor a __xen_guest_string.  This patch
checks for the existence of the __xen_guest_string prior to using it.
Please apply.  Thanks,

Alex

Signed-off-by: Alex Williamson <alex.williamson@hp.com>
---

tools/libxc/xc_load_elf.c
xen/common/elf.c

index 9964a0dbb47694ea15873c2267145959ec0c5e9d..3fbd3d9ccc623155e58a891a6ecfc57008072cbc 100644 (file)
@@ -93,6 +93,9 @@ static const char *xen_guest_lookup(struct domain_setup_info *dsi, int type)
     const char *fallback;
     const char *p;
 
+    if ( !dsi->__xen_guest_string )
+        return NULL;
+
     if ( type > sizeof(xenguest_fallbacks) )
         return NULL;
 
index 594060c99b2e9f3131b9510c293334f29efa2822..00730c1bb86f8d60dfdc79b85688df536f904fb4 100644 (file)
@@ -49,6 +49,9 @@ static const char *xen_guest_lookup(struct domain_setup_info *dsi, int type)
     const char *fallback;
     const char *p;
 
+    if ( !dsi->__xen_guest_string )
+        return NULL;
+
     if ( type > sizeof(xenguest_fallbacks) )
         return NULL;